﻿var storeMenuCleaner;
var storeSettingToiletCleaner;
var storeSettingToiletCleanerDoubleClick;
var storeMenuTemporaryMission;
var storeMenuJobFeedback;
var storeMenuAttendanceInfo;
var storeMenuToiletWorkInfo;
var storeMenuCleanerTeam = createStoreMenuCleanerTeam();
var dataDefaultCMB = new Date();
dataDefaultCMB.setTime(dataDefaultCMB.getTime() - 3600 * 1000 * 24);

/* ---菜单  考勤记录1---*/
function menuToiletWorkInfoData() {
    storeMenuToiletWorkInfo.load({
        params: { clientNo: userClientNo, date: dataFormat(Ext.getCmp('dateSearchMission').getValue(), "yyyy-MM-dd"), name: Ext.getCmp('textfieldName').getValue(), op: 'GetMenuToiletWorkInfo' }
    });
}
function menuToiletWorkInfo() {
    storeMenuToiletWorkInfo = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'name' }, { name: 'time' }, { name: 'toiletName' }, { name: 'sex'}])
            )
    });
    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 85%',
        columns: [
	{ header: "姓名", dataIndex: "name", width: 60 },
    { header: "公厕名称", dataIndex: "toiletName", width: 100 },
	{ header: "开始时间", dataIndex: "time", width: 100 },
    { header: "结束时间", dataIndex: "workAround", width: 100 },
    { header: "持续时间", dataIndex: "amIN", width: 100 },
    { header: "男女厕", dataIndex: "sex", width: 100 }
	],
        store: storeMenuToiletWorkInfo
    });

    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuToiletWorkInfoTitleView(), this_grid]
    });

    menuToiletWorkInfoData();
    var window = new Ext.Window({
        title: '公厕作业记录',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}
function menuToiletWorkInfoTitleView() {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 15.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .3,
                height: 40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '时间：' }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m',
                    id: "dateSearchMission",
                    value: dataDefaultCMB
                }]
            }, {
                columnWidth: .3,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '班组：' },
                        inicmbCleanerTeam()
                    ]
            },{
                columnWidth: .3,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '姓名：' }, { xtype: 'textfield', width: 150, id: "textfieldName"}]
            }]
        }],
        buttons: [
        {
            text: "查询",
            handler: menuToiletWorkInfoData
        }
        ]
    });
}
/* ---菜单  考勤记录2---*/
function menuAttendanceInfoData() {
    storeMenuAttendanceInfo.load({
        params: { clientNo: userClientNo, date: dataFormat(Ext.getCmp('dateSearchMission').getValue(), "yyyy-MM-dd"), statue: "", op: 'GetMenuAttendanceInfoDay' }
        , callback: function (records, options, success) {
            Ext.getCmp("menuAttendanceInfoDayLabel").setText(records[0].get("statusString"));
        }
    });
}
function menuAttendanceInfoDay() {
    storeMenuAttendanceInfo = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'name' }, { name: 'clientName' }, { name: 'wcName' }, { name: 'statusString' }, { name: 'amIN' }, { name: 'amOUT' }, { name: 'pmIN' }, { name: 'pmOUT'}])
            )
    });
    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 75%',
        columns: [
	{ header: "姓名", dataIndex: "name", width: 60 },
    { header: "清运队", dataIndex: "clientName", width: 100 },
	{ header: "班组", dataIndex: "clientName2", width: 100 },
    { header: "作业范围", dataIndex: "workAround", width: 100 },
    { header: "上午签入", dataIndex: "amIN", width: 100 },
    { header: "上午签出", dataIndex: "amOUT", width: 100 },
    { header: "下午签入", dataIndex: "pmIN", width: 100 },
    { header: "下午签出", dataIndex: "pmOUT", width: 100 }
	],
        store: storeMenuAttendanceInfo
    });
    var exportButton = new Ext.ux.Exporter.Button({
        component: this_grid,
        text: "导出Excel"
    });
    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuAttendanceInfoTitleView(exportButton), this_grid]
    });

    menuAttendanceInfoData();
    var window = new Ext.Window({
        title: '日考勤记录',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}
function menuAttendanceInfoTitleView(exportButton) {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });

    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 25.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .5,
                height: 40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '时间：' }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m',
                    id: "dateSearchMission",
                    value: dataDefaultCMB
                }]
            }, {
                columnWidth: .5,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '班组：' },
                        inicmbCleanerTeam()
                    ]
            }, {
                    columnWidth: .8,
                    layout: 'form',
                    items: [
                        { xtype: "label", id: "menuAttendanceInfoDayLabel", labelStyle: "text-align:right;" }
                    ]
                }]
        }],
        buttons: [
        {
            text: "查询",
            handler: menuAttendanceInfoData
        }, exportButton
        ]
    });

    
}

/* ---菜单2  考勤记录 月---*/
function menuAttendanceInfoDataMonth() {
    storeMenuAttendanceInfo.load({
        params: { clientNo: userClientNo, date: dataFormat(Ext.getCmp('dateSearchMission').getValue(), "yyyy-MM-dd"), statue: "", op: 'GetMenuAttendanceInfoMonth' }
        , callback: function (records, options, success) {
            Ext.getCmp("menuAttendanceInfoMonthLabel").setText(records[0].get("statusString"));
            //            Ext.getCmp("menuAttendanceInfoCount").setText("记录数：" + records.length + "条");
        }
    });
}
function menuAttendanceInfoMonth() {
    storeMenuAttendanceInfo = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'name' }, { name: 'clientName' }, { name: 'wcName' }, { name: 'normal' }, { name: 'late' }, { name: 'LeaveEarly' }, { name: 'comeNoC' }, { name: 'leaveNoC' }, { name: 'queS' }, { name: 'VID' }, { name: 'statusString'}])
            )
    });
    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 75%',
        columns: [
	{ header: "姓名", dataIndex: "name", width: 60 },
    { header: "所属分组", dataIndex: "clientName", width: 100 },
	{ header: "负责公厕", dataIndex: "wcName", width: 100 },
    { header: "正常", dataIndex: "normal", width: 100 },
    { header: "迟到", dataIndex: "late", width: 100 },
    { header: "早退", dataIndex: "LeaveEarly", width: 100 },
    { header: "上班未打卡", dataIndex: "comeNoC", width: 100 },
    { header: "下班未打卡", dataIndex: "leaveNoC", width: 100 },
    { header: "缺勤", dataIndex: "queS", width: 100 }
	], //                        姓名	所属分组	负责公厕	正常	迟到	早退	上班未打卡	下班未打卡	缺勤	VID
        store: storeMenuAttendanceInfo
    });
    var exportButton = new Ext.ux.Exporter.Button({
        component: this_grid,
        text: "导出Excel"
    });
    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuAttendanceInfoTitleViewMonth(exportButton), this_grid]
    });

    menuAttendanceInfoDataMonth();
    var window = new Ext.Window({
        title: '日考勤记录',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}
function menuAttendanceInfoTitleViewMonth(exportButton) {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 25.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .5,
                height: 40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '时间：' }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m',
                    id: "dateSearchMission",
                    value: dataDefaultCMB
                }]
            }, {
                columnWidth: .5,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '班组：' },
                        inicmbCleanerTeam()
                    ]
            }, {
                    columnWidth: .8,
                    layout: 'form',
                    items: [
                        { xtype: "label", id: "menuAttendanceInfoMonthLabel", labelStyle: "text-align:right;" }
                    ]
                }]
        
        }],
        buttons: [
        {
            text: "查询",
            handler: menuAttendanceInfoDataMonth
        }, exportButton
        ]
    });
}
/* ---菜单4  反馈记录---*/
function menuJobFeedback() {
    storeMenuJobFeedback = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'clientNo' }, { name: 'time' }, { name: 'roadName' }, { name: 'location' }, { name: 'detail'}])
            )
    });
    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 75%',
        columns: [
	{ header: "班组编号", dataIndex: "clientNo", width: 60 },
    { header: "时间", dataIndex: "time", width: 100 },
	{ header: "公厕", dataIndex: "roadName", width: 100 },
    { header: "位置", dataIndex: "location", width: 100 },
    { header: "详情", dataIndex: "detail", width: 100 }
	],
        store: storeMenuJobFeedback
    });

    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuJobFeedbackTitleView(), this_grid]
    });

    menuJobFeedbackData();
    var window = new Ext.Window({
        title: '反馈记录信息列表',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}

function menuJobFeedbackData() {
    var para_clientNo = userClientNo;
    if (Ext.getCmp('cmbToiletMenu_CleanerTeam')) {
        if (Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue()) {
            para_clientNo = Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue();
        }
    }
    storeMenuJobFeedback.removeAll();
    storeMenuJobFeedback.load({
        params: { clientNo: para_clientNo, wcName: Ext.getCmp('textfieldName').getValue(), date1: dataFormat(Ext.getCmp('dateSearchStart').getValue(), "yyyy-MM-dd"), date2: dataFormat(Ext.getCmp('dateSearchEnd').getValue(), "yyyy-MM-dd"), op: 'GetMenuJobFeedback' }
        , callback: function (records, options, success) {
            Ext.getCmp("menuJobFeedbackCount").setText("记录数：" + records.length + "条");
        }
    });
}

function menuJobFeedbackTitleView() {
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 25.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .3,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '公厕：' }, { xtype: 'textfield', width: 120, id: "textfieldName"}]

            }, {
                columnWidth: .3,
                height: 40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '时间：' }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m-d',
                    id: "dateSearchStart",
                    value: new Date(2020, parseInt(1) - 1, 1)
                }]
            }, {
                columnWidth: .3,
                height: 40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 30, text: '到：', labelStyle: "text-align:right;" }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m-d',
                    id: "dateSearchEnd",
                    value: dataDefaultCMB
                }]
            }, {
                columnWidth: .3,
                layout: 'form',
                items: [
                        { xtype: "label", id: "menuJobFeedbackCount", labelStyle: "text-align:right;" }
                    ]
            }]
        }],
        buttons: [
        {
            text: "查询",
            handler: menuJobFeedbackData
        }
        ]
    });
}

/* ---菜单3  临时任务---*/
function menuTemporaryMission() {
    storeMenuTemporaryMission = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'missionDate' }, { name: 'missionToilet' }, { name: 'missionAD' }, { name: 'clientName' }, { name: 'missionStatus' }, { name: 'missionAsk'}])
            )
    });
    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 75%',
        columns: [
	{ header: "任务时间", dataIndex: "missionDate", width: 60 },
    { header: "任务公厕", dataIndex: "missionToilet", width: 100 },
	{ header: "任务地点", dataIndex: "missionAD", width: 100 },
    { header: "负责机构", dataIndex: "clientName", width: 100 },
    { header: "任务状态", dataIndex: "missionStatus", width: 100 },
    { header: "任务要求", dataIndex: "missionAsk", width: 100 }
	],
        store: storeMenuTemporaryMission
    });

    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuTemporaryMissionTitleView(), this_grid]
    });

    menuTemporaryMissionData();
    var window = new Ext.Window({
        title: '临时任务',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}

function menuTemporaryMissionTitleView() {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 25.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .5,
                height:40,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 100, text: '任务创建时间：' }
                , {
                    width: 150,
                    xtype: 'datefield',
                    format: 'Y-m-d',
                    id: "dateSearchMission",
                    value: dataDefaultCMB
                }]
            },
                {
                    columnWidth: .5,
                    height: 40,
                    layout: { type: 'hbox' },
                    items: [{ xtype: "label", width: 60, text: '组织机构：' },
                        inicmbCleanerTeam()
                    ]
                },
                {
                    columnWidth: .5,
                    layout: { type: 'hbox' },
                    items: [{ xtype: "label", width: 100, text: '任务状态：' }
                    , inicmbMissionState()
                    ]
                },
                {
                    columnWidth: .2,
                    layout: 'form',
                    items: [
                        { xtype: "label", id: "menuCleanerCount",labelStyle : "text-align:right;" }
                    ]
                }]
        }],
        buttons: [
        {
            text: "新增",
            handler: menuTemporaryMissionDataADD
        }, {
            text: "查询",
            handler: menuTemporaryMissionData
        }
        ]
    });
}

function menuTemporaryMissionData() {
    var para_clientNo = userClientNo;
    if (Ext.getCmp('cmbToiletMenu_CleanerTeam')) {
        if (Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue()) {
            para_clientNo = Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue();
        }
    }
    storeMenuTemporaryMission.removeAll();
    storeMenuTemporaryMission.load({
        params: { clientNo: para_clientNo, date: dataFormat(Ext.getCmp('dateSearchMission').getValue(), "yyyy-MM-dd"), name: "", status: Ext.getCmp('cmbMissionState').getValue(), op: 'GetMenuTemporaryMission' }
        , callback: function (records, options, success) {
            Ext.getCmp("menuCleanerCount").setText("记录数：" + records.length + "条");
        }
    });
}
function menuTemporaryMissionDataADD() { }

/* ---菜单2  作业公厕设定1---*/
function SettingToiletCleanerRowDoubleClick(grid, rowIndex, e) {
    storeSettingToiletCleanerDoubleClick = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'name' }, { name: 'startTime' }, { name: 'endTime' }, { name: 'createDate' }, { name: 'level' }, { name: 'workCount' }])
            )
    });

    var this_gridDoubleClick = new Ext.grid.GridPanel({
        anchor: '100% 85%',
        columns: [
	{ header: "维保公厕", dataIndex: "name", width: 100 },
    { header: "维保开始时间", dataIndex: "startTime", width: 100 },
	{ header: "维保结束时间", dataIndex: "endTime", width: 100 },
    { header: "维护公厕", dataIndex: "createDate", width: 100 },
    { header: "维护次数", dataIndex: "level", width: 100 },
    { header: "设置时间", dataIndex: "workCount", width: 100 }
	],
        store: storeSettingToiletCleanerDoubleClick
    });

//    this_grid.addListener('rowdblclick', SettingToiletCleanerRowDoubleClick);

//    var panel = new Ext.Panel({
//        layout: 'anchor',
//        items: [menuSettingToiletCleanerTitleView(), this_grid]
//    });
    var name = grid.getStore().getAt(rowIndex).data.name;
    SettingToiletCleanerDoubleClick(name);

    var windowDoubleClick = new Ext.Window({
        title: '人员作业公厕',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 200,
        items: this_gridDoubleClick         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    windowDoubleClick.show();
}

function SettingToiletCleanerDoubleClick(name){
    storeSettingToiletCleanerDoubleClick.load({
        params: { cleanerName: name, op: 'GetMenuSetCleanerListDoubleClick'}
        , callback: function (records, options, success) {
//            Ext.getCmp("menuCleanerCount").setText("记录数：" + records.length + "条");
        }
    });
//    storeSettingToiletCleanerDoubleClick.load({
//        params: { cleanerName: name, op: 'GetMenuSetCleanerListDoubleClick'}//区名、日期、中转站or处理厂、中转站类型or处理厂类型
//                    , callback: function (records, options, success) {
//                        if (success && records.length) {
//                            //                            SettingToiletCleanerWindow(this);
////                            Ext.getCmp("menuSettingToiletCleanerCount").setText("记录数：" + records.length + "条");
//                        }
//                    }
//    });
}

function SettingToiletCleanerWindow() {
    storeSettingToiletCleaner = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'vid' }, { name: 'name' }, { name: 'ToiletName' }, { name: 'clientName' }, { name: 'startDate' }, { name: 'endDate' }, { name: 'settingDate'}])
            )
    });

    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 85%',
        columns: [
	{ header: "序号", dataIndex: "vid", width: 100 },
    { header: "姓名", dataIndex: "name", width: 100 },
	{ header: "所属机构", dataIndex: "clientName", width: 100 },
    { header: "维护公厕", dataIndex: "ToiletName", width: 100 },
//    { header: "维护开始时间", dataIndex: "startDate", width: 100 },
//    { header: "维护结束时间", dataIndex: "endDate", width: 100 },
//    { header: "设置时间", dataIndex: "settingDate", width: 100 }
	],
        store: storeSettingToiletCleaner
    });

//    this_grid.addListener('rowdblclick', function (store, records, index) { });
    this_grid.addListener('rowdblclick', SettingToiletCleanerRowDoubleClick);
    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuSettingToiletCleanerTitleView(), this_grid]
    });

    SettingToiletCleaner();

    var window = new Ext.Window({
        title: '人员作业公厕',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}
function menuSettingToiletCleanerTitleView() {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 15.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                    columnWidth: .5,
                    layout: { type: 'hbox' },
                    items: [{ xtype: "label", width: 60, text: '组织机构：' },
                        inicmbCleanerTeam()
                    ]
                },
                {
                    columnWidth: .2,
                    layout: 'form',
                    items: [
                        { xtype: "label", id: "menuSettingToiletCleanerCount" }
                    ]
                }]
        }],
        buttons: [
        {
            text: "查询",
            handler: SettingToiletCleaner
        }
        ]
    });
}
function SettingToiletCleaner() {
    var para_clientNo = userClientNo;
    if (Ext.getCmp('cmbToiletMenu_CleanerTeam')) {
        if (Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue()) {
            para_clientNo = Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue();
        }
    }
    storeSettingToiletCleaner.removeAll();
    storeSettingToiletCleaner.load({
        params: { clientNo: para_clientNo, op: 'GetMenuSetCleanerList'}//区名、日期、中转站or处理厂、中转站类型or处理厂类型
                    , callback: function (records, options, success) {
                        if (success && records.length) {
                            //                            SettingToiletCleanerWindow(this);
                            Ext.getCmp("menuSettingToiletCleanerCount").setText("记录数：" + records.length + "条");
                        }
                    }
    });
}


/* ---菜单2  作业公厕设定2---*/
function SettingToiletWork(clientName, date, type, name) {
    var weightVehicleInfoNew = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'vid' }, { name: 'ToiletName' }, { name: 'clientName' }, { name: 'peopleNames' }])
            )
    });
    weightVehicleInfoNew.load({
        params: { clientNo: userClientNo, op: 'GetMenuSetToiletList'}//区名、日期、中转站or处理厂、中转站类型or处理厂类型
                    , callback: function (records, options, success) {
                        if (success && records.length) {
                            SettingToiletWorkWindow(this);
                        }
                    }
    });
}
function SettingToiletWorkWindow(item) {
    var this_grid = new Ext.grid.GridPanel({
        columns: [
	{ header: "序号", dataIndex: "vid", width: 60 },
    { header: "公厕名称", dataIndex: "ToiletName", width: 100 },
	{ header: "所属机构", dataIndex: "clientName", width: 100 },
    { header: "负责维护人员", dataIndex: "peopleNames", width: 300 }
	],
        store: item
    });

    var panel = new Ext.Panel({
        layout: 'fit',
        items: this_grid
    });
    var window = new Ext.Window({
        title: '公厕作业人员查询',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}

/* ---菜单1  人员管理---*/
function menuCleaner() {
    storeMenuCleaner = new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'name' }, { name: 'simNO' }, { name: 'clientNO' }, { name: 'sex' }, { name: 'phone' }, { name: 'worktype' }, { name: 'birthDay' }, { name: 'workDay'}])
            )
    });

    var this_grid = new Ext.grid.GridPanel({
        anchor: '100% 85%',
        columns: [
	{ header: "姓名", dataIndex: "name", width: 60 },
    { header: "通讯卡号", dataIndex: "simNO", width: 130 },
	{ header: "组织编号", dataIndex: "clientNO", width: 100 },
    { header: "性别", dataIndex: "sex", width: 40 },
    { header: "电话", dataIndex: "phone", width: 80 },
	{ header: "工种", dataIndex: "worktype", width: 80 },
    { header: "生日", dataIndex: "birthDay", width: 100 },
	{ header: "入职时间", dataIndex: "workDay", width: 100 }
	],
        store: storeMenuCleaner
    });
    var panel = new Ext.Panel({
        layout: 'anchor',
        items: [menuCleanerTitleView(), this_grid]
    });
    menuCleanerData();
    var window = new Ext.Window({
        title: '人员信息列表',
        layout: 'fit',       //弹出窗口内布局会充满整个窗口;
        width: 700,          //设置窗口大小;
        height: 500,
        items: panel         //默认会生成Ext.Panel类型的对象;并且随窗口大小改变而改变;
    });
    window.show();
}
function menuCleanerTitleView() {
    storeMenuCleanerTeam.load({ params: { clientNo: userClientNo, op: 'GetMenuCleanerTeam'} });
    return new Ext.Panel({
        labelAlign: 'top',
        frame: true,
        //title: '查询条件',
        bodyStyle: 'padding:0px 0px 0',
        anchor: '100% 15.5%',
        //width: 720,
        items: [{
            layout: 'column',
            items: [{
                columnWidth: .3,
                layout: { type: 'hbox' },
                items: [{ xtype: "label", width: 40, text: '姓名：' }, { xtype: 'textfield', width: 100, id: "textfieldName"}]
            },
                {
                    columnWidth: .5,
                    layout: { type: 'hbox' },
                    items: [{ xtype: "label", width: 60, text: '组织机构：' },
                        inicmbCleanerTeam()
                    ]
                },
                {
                    columnWidth: .2,
                    layout: 'form',
                    items: [
                        { xtype: "label", id: "menuCleanerCount" }
                    ]
                }]
        }],
        buttons: [
        {
            text: "增加",
            handler: menuCleanerDataADD
        }, {
            text: "删除",
            handler: menuCleanerDataDelete
        }, {
            text: "查询",
            handler: menuCleanerData
        }
        ]
    });
}
//查询
function menuCleanerData() {
    var para_clientNo = userClientNo;
    if (Ext.getCmp('cmbToiletMenu_CleanerTeam')) {
        if (Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue()) {
            para_clientNo = Ext.getCmp('cmbToiletMenu_CleanerTeam').getValue();
        }
    }
    storeMenuCleaner.removeAll();
    storeMenuCleaner.load({
        params: { clientNo: para_clientNo, name: Ext.getCmp('textfieldName').getValue(), op: 'GetMenuCleanerList'}//区名、日期、中转站or处理厂、中转站类型or处理厂类型
        , callback: function (records, options, success) {
            Ext.getCmp("menuCleanerCount").setText("记录数：" + records.length + "条");
        }
    });
}
//增加
function menuCleanerDataADD() { }
//删除
function menuCleanerDataDelete() { }

/*创建选择模块*/
function inicmbDate() {
    return new Ext.ux.form.DateTimeField({
//        fieldLabel: fieldLabel,
        width: 180,
        format: 'Y-m-d',
        allowBlank: false,
        id: "SelectDate",
        value: dataDefaultCMB
    });
}

function inicmbMissionState() {

    //var carState = [["全部", "全部"], ["在线", "在线"], ["离线", "离线"]];
    var proxy = new Ext.data.MemoryProxy([["全部", "全部"], ["待接收", "待接收"], ["已接收", "已接收"]]);
    var Type_Car = Ext.data.Record.create([{ name: "cid", type: "string", mapping: 0 }, { name: "cname", type: "string", mapping: 1}]);
    var reader = new Ext.data.ArrayReader({}, Type_Car);
    var store = new Ext.data.Store({
        proxy: proxy,
        reader: reader//,
        //autoLoad:true
    });
    store.load();
    //定义一个下拉框
    var cmbCarState = new Ext.form.ComboBox({
//        fieldLabel: '状态',
        id: 'cmbMissionState',
        width: 150,
        allowBlank: false,
        triggerAction: "all", //是否开启自动查询功能
        store: store, //定义数据源
        displayField: "cname", //关联某一个逻辑列名作为显示值
        valueField: "cid", //关联某一个逻辑列名作为实际值
        mode: "local", //如果数据来自本地用local 如果来自远程用remote默认为remote
        emptyText: "请选择状态"//没有选择时候的默认值

    });
    Ext.getCmp("cmbMissionState").setValue("全部");
    return cmbCarState;
}

function createStoreMenuCleanerTeam() {
    return new Ext.data.Store({
        url: "./Json/JsonGetToiletInfoList.ashx",
        autoLoad: true,
        reader: new Ext.data.JsonReader(
                { root: 'data' },
                Ext.data.Record.create([{ name: 'CLIENT_NO' }, { name: 'CLIENT_NAME'}])
            )
    });
}
function inicmbCleanerTeam() {
    var box = new Ext.form.ComboBox({
        //        fieldLabel: '组织机构',
        id: 'cmbToiletMenu_CleanerTeam',
        width: 150,
        //        labelWidth: 20, 
        allowBlank: false,
        triggerAction: "all", //是否开启自动查询功能
        store: storeMenuCleanerTeam, //定义数据源
        displayField: "CLIENT_NAME", //关联某一个逻辑列名作为显示值
        valueField: "CLIENT_NO",
        hiddenName: "CLIENT_NO_hiddenName", //关联某一个逻辑列名作为实际值
        mode: "local", //如果数据来自本地用local 如果来自远程用remote默认为remote
        emptyText: "请选择组织机构"//没有选择时候的默认值
    });

    return box;
}